package com.feng.service.impl;

import com.feng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @author: 丰
 * @date: 2023/2/2 13:49
 */
@Service
public class MyUserDetailsService implements UserDetailsService {

    // 调用服务层实现逻辑处理
    @Autowired
    private UserService userService;

    // 认证
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return userService.userSetAuthentication(username);
    }
}
